<div class="layuimini-container">
    <div class="layuimini-main">
        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
    </div>
</div>

<script>
    layui.use(['form', 'table'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table;
        table.render({
            elem: '#currentTableId',
            url: '{:url("cron/log",["crontab_id"=>$params["crontab_id"]])}',
            defaultToolbar: ['filter', 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            cols: [[
                {type: "checkbox"},
                {field: 'id', width: 60, title: 'ID'},
                {field: 'title', title: '任务名称'},
                {
                    field: 'type', minWidth: 80, title: '任务类型', templet: function (d) {
                        if (d.type == 'shell') {
                            return 'Shell脚本';
                        } else {
                            return '访问url';
                        }
                    }
                },
                {field: 'crontab_id', width: 80, title: '任务ID'},
                {field: 'remark', title: '日志备注'},
                {field: 'create_time', title: '时间'},
                {
                    align: "center", title: '状态', width: 100, templet: function (d) {
                        return d.status_text;
                    }
                }
            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 15,
            page: true,
            skin: 'line'
        });

        /**
         * toolbar监听事件
         */
        table.on('toolbar(currentTableFilter)', function (obj) {
            var event = obj.event;
        });

        //监听表格复选框选择
        table.on('checkbox(currentTableFilter)', function (obj) {
            console.log(obj)
        });

        table.on('tool(currentTableFilter)', function (obj) {
            var data = obj.data;
            var layEvent = obj.event;
        });
    });
</script>